package com.way;

import java.util.concurrent.locks.LockSupport;

/**
 * @author 魏彪
 */
public class PartTest {
    public static void main(String[] args) {
        Thread t1 = new Thread(() -> {
            System.out.println("线程1执行");
            LockSupport.park();
            System.out.println("线程1执行解除阻塞之后");
        }, "线程1");
        t1.start();

        Thread t2 = new Thread(() -> {
            System.out.println("线程2执行");
            try {
                Thread.sleep(5000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
            LockSupport.unpark(t1);
        }, "线程1");
        t2.start();
    }
}
